/**
 *  产品配置
 * @auther jiagnqifan
 * @since 2016-03-31
 */
var mongoose  = require('mongoose');
var BaseModel = require("./base_model");
var Schema    = mongoose.Schema;

var ProductConfigSchema = new Schema({
    name:{
      type: String,
      required: true
    },
    project:{//项目
      type: Schema.Types.ObjectId,
      ref: 'Project'
    },
    workspace:{
        type: Schema.Types.ObjectId,
        ref: 'Workspace'
    },
    projects:[{//工程
      name:String,
      location:String//相对于workspace地址
    }],
    type:{
      type: String, //mk_back|app_android|app_ios
      required: true
    },
    version:{
      type: String,
      required: true
    },
    detail: {
      type: Schema.Types.Mixed
    },
    create_at: { type: Date, default: Date.now },
    update_at: { type: Date, default: Date.now }
});
ProductConfigSchema.plugin(BaseModel);
module.exports = mongoose.model('ProductConfig', ProductConfigSchema);
